#ifndef CPLAYERBEHAVIOUR_H
#define CPLAYERBEHAVIOUR_H

#include "../include/IMovableEntityBehaviour.h"

#define MAX_SHOTS 9 //maximum number of shots that the player can throw at a same time

//we use this struct when we create shots
//when we have 1 shot, we display it on the position of the ship avec we make it go up
//when we have 2 shots, we display one on the les of the ship and one on the right avec we make it go up
//when we have 3 shots, we do another thing, etc...
//so we need position on x and y, and its speed, on x and y
struct Rect
{
    int iX;
    int iY;
    int iSpeedX;
    int iSpeedY;
};

//**************************
//Manage the behaviour of a Player
//**************************
class CPlayerBehaviour : public IMovableEntityBehaviour
{
    private:
        long m_lCurrentScore;       //current score of the player
        int m_iEnemiesKilled;       //number of enemies that the player killed
        int * m_iNBShots;     //tab of number of shots
                                    //for each type of shots, we have to know how many the players can throw

        Rect * m_DirectionShots[MAX_SHOTS]; //this tab will store directions for shot
                                                //because we don't shoot 2 shots like we shoot 3 shots

    public:
        //**************************
        //Description : Constructor
        //Parameters : Value for m_iX, m_iY,
        //              m_iSpeedX, m_iSpeedY,
        //              m_iWidth, m_iHeight,
        //              the ratio for the collision box
        //              the type of colision
        //              and m_iLives
        //Note : None
        //**************************
        CPlayerBehaviour(int _iX = INITX_PLAYER, int _iY = INITY_PLAYER,
                        int _iSpeedX = SPEEDX_PLAYER, int _iSpeedY = SPEEDY_PLAYER,
                        int _iWidth = 0, int _iHeight = 0,
                        float _fRatioW = COLISIONBOX_RATIO_WIDTH, float _fRatioH = COLISIONBOX_RATIO_HEIGHT,
                        TYPE_COLLISION _iTypeCollision = AIR,
                        int _iLives = NUMBER_LIVES_PLAYER);

        //**************************
        //Description : Copy Constructor
        //Parameters : A CPlayerBehaviour
        //Note : None
        //**************************
        CPlayerBehaviour(CPlayerBehaviour & _Player);

        //**************************
        //Description : Destructor
        //Parameters : None
        //Note : None
        //**************************
        virtual ~CPlayerBehaviour();

        //**************************
        //Description : The player can throw 1 more shot at a time
        //Parameters : The type of shot that is powered up
        //Return Value : None
        //Note : None
        //**************************
        void ShotsUp(int _iTypeOfShot);

        //**************************
        //Description : Add _iNbPoints to the score of the player
        //Parameters : The number of points to add
        //Return Value : None
        //Note : None
        //**************************
        void AddPoints(long _iNbPoints);

        //**************************
        //Description : Return the score of the player
        //Parameters : None
        //Return Value : The score of the player
        //Note : None
        //**************************
        long GetPoints() const;

        //**************************
        //Description : Set the number of shots for each shots
        //Parameters : The tab of the number of shots
        //Return Value : None
        //Note : None
        //**************************
        void SetNbShots(int * _iNbShots);

        //**************************
        //Description : Return the number of shots of each type of shot
        //Parameters : None
        //Return Value : The tab of nb shots
        //Note : None
        //**************************
        int * GetNbShots() const;

        //**************************
        //Description : Add an enemy to the number of killed enemy
        //Parameters : The number of ennemies
        //Return Value : None
        //Note : None
        //**************************
        void AddEnemiesKilled(int _iNbEnemiesKilled = 1);

        //**************************
        //Description : Return the number of enemies that the player killed
        //Parameters : None
        //Return Value : The number of enemies that the player killed
        //Note : None
        //**************************
        int GetEnemiesKilled() const;

        //**************************
        //Description : The entity shoot
        //Parameters : The tab of animations shot and the screen
        //Return Value : True if the enemy has shot, otherwise false
        //Note : Virtual because the way of shooting depends on the entity
        //**************************
        virtual bool Shoot(CSpriteAnimation * _SpriteAnimationShot, SDL_Surface * _screen);

        //**************************
        //Description : Update the trajectory of the entity
        //Parameters : None
        //Return Value : None
        //Note : Virtual because actions depends on the entity type
        //**************************
        virtual void EntityTrajectory();
};
#endif
